home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / unix / volume1 / xlisp1.4 / part1 next >
Encoding:
Internet Message Format  |  1986-11-30  |  52.9 KB

  1. Date: Wed, 13 Mar 85 16:47:35 pst
  2. From: decvax!ucbvax!UCBJADE!ucbjade:mwm (Mike Meyer)
  3. Message-Id: <8503140047.AA11791@ucbjade.CC.Berkeley.ARPA>
  4. Subject: XLISP 1.4 part 1 (of 4)
  5.  
  6.  
  7. #! /bin/sh
  8. # This is a shell archive, meaning:
  9. # 1. Remove everything above the #! /bin/sh line.
  10. # 2. Save the resulting text in a file.
  11. # 3. Execute the file with /bin/sh (not csh) to create the files:
  12. #    xlisp.doc
  13. # This archive created: Mon Dec  2 10:09:35 1985
  14. export PATH; PATH=/bin:$PATH
  15. echo shar: extracting "'xlisp.doc'" '(53349 characters)'
  16. if test -f 'xlisp.doc'
  17. then
  18.     echo shar: will not over-write existing file "'xlisp.doc'"
  19. else
  20. sed 's/^X//' << \SHAR_EOF > 'xlisp.doc'
  21.  
  22.  
  23.  
  24.  
  25.  
  26.             XLISP: An Experimental Object Oriented Language
  27.  
  28.                               Version 1.4
  29.  
  30.                             January 1, 1985
  31.  
  32.  
  33.                                    by
  34.                                David Betz
  35.                            114 Davenport Ave.
  36.                          Manchester, NH  03103
  37.  
  38.                          (603) 625-4691 (home)
  39.  
  40.  
  41.  
  42.       XLISP: An Experimental Object Oriented Language                 Page 2
  43.       TABLE OF CONTENTS
  44.  
  45.  
  46.               1.0     INTRODUCTION . . . . . . . . . . . . . . . . . . . . 3
  47.               2.0     A NOTE FROM THE AUTHOR . . . . . . . . . . . . . . . 4
  48.               3.0     XLISP COMMAND LOOP . . . . . . . . . . . . . . . . . 5
  49.               4.0     BREAK COMMAND LOOP . . . . . . . . . . . . . . . . . 6
  50.               5.0     DATA TYPES . . . . . . . . . . . . . . . . . . . . . 7
  51.               6.0     THE EVALUATOR  . . . . . . . . . . . . . . . . . . . 8
  52.               7.0     LEXICAL CONVENTIONS  . . . . . . . . . . . . . . . . 9
  53.               8.0     OBJECTS  . . . . . . . . . . . . . . . . . . . . .  10
  54.               9.0     SYMBOLS  . . . . . . . . . . . . . . . . . . . . .  13
  55.               10.0    EVALUATION FUNCTIONS . . . . . . . . . . . . . . .  14
  56.               11.0    SYMBOL FUNCTIONS . . . . . . . . . . . . . . . . .  15
  57.               12.0    PROPERTY LIST FUNCTIONS  . . . . . . . . . . . . .  17
  58.               13.0    LIST FUNCTIONS . . . . . . . . . . . . . . . . . .  18
  59.               14.0    DESTRUCTIVE LIST FUNCTIONS . . . . . . . . . . . .  21
  60.               15.0    PREDICATE FUNCTIONS  . . . . . . . . . . . . . . .  22
  61.               16.0    CONTROL FUNCTIONS  . . . . . . . . . . . . . . . .  24
  62.               17.0    LOOPING FUNCTIONS  . . . . . . . . . . . . . . . .  25
  63.               18.0    THE PROGRAM FEATURE  . . . . . . . . . . . . . . .  26
  64.               19.0    DEBUGGING AND ERROR HANDLING . . . . . . . . . . .  27
  65.               20.0    ARITHMETIC FUNCTIONS . . . . . . . . . . . . . . .  28
  66.               21.0    BITWISE LOGICAL FUNCTIONS  . . . . . . . . . . . .  29
  67.               22.0    RELATIONAL FUNCTIONS . . . . . . . . . . . . . . .  30
  68.               23.0    STRING FUNCTIONS . . . . . . . . . . . . . . . . .  31
  69.               24.0    INPUT/OUTPUT FUNCTIONS . . . . . . . . . . . . . .  32
  70.               25.0    FILE I/O FUNCTIONS . . . . . . . . . . . . . . . .  33
  71.               26.0    SYSTEM FUNCTIONS . . . . . . . . . . . . . . . . .  34
  72.  
  73.  
  74.  
  75.       XLISP: An Experimental Object Oriented Language                 Page 3
  76.       INTRODUCTION
  77.  
  78.  
  79.       1.0  INTRODUCTION
  80.  
  81.       XLISP is an experimental programming language combining some
  82.       of  the  features  of LISP with an object oriented extension
  83.       capability.  It was  implemented  to  allow  experimentation
  84.       with  object oriented programming on small computers.  There
  85.       are currently implementations running on  the  PDP-11  under
  86.       UNIX  V7, on the VAX-11 under VAX/VMS and Berkeley VAX/UNIX,
  87.       and on the 8088/8086 under CP/M-86 or MS-DOS.  A version  is
  88.       currently  being  developed for the 68000 under CP/M-68K and
  89.       for the Apple Macintosh.  It is completely  written  in  the
  90.       programming  language  'C'  and is easily extended with user
  91.       written built-in functions and classes.  It is available  in
  92.       source   form   free  of  charge  to  non-commercial  users.
  93.       Prospective commercial users should contact the  author  for
  94.       permission to use XLISP.
  95.  
  96.       Many traditional LISP functions are built  into  XLISP.   In
  97.       addition,  XLISP defines the objects 'Object' and 'Class' as
  98.       primitives.   'Object'  is  the  only  class  that  has   no
  99.       superclass  and  hence  is  the  root of the class heirarchy
  100.       tree.  'Class'  is  the  class  of  which  all  classes  are
  101.       instances  (it  is  the  only  object that is an instance of
  102.       itself).
  103.  
  104.       This document is intended  to  be  a  brief  description  of
  105.       XLISP.    It   assumes  some  knowledge  of  LISP  and  some
  106.       understanding   of   the   concepts   of   object   oriented
  107.       programming.
  108.  
  109.       Version 1.2 of XLISP differs from  version  1.1  in  several
  110.       ways.   It  supports  many  more Lisp functions.  Also, many
  111.       version 1.1  functions  have  been  renamed  and/or  changed
  112.       slightly  to follow traditional Lisp usage.  One of the most
  113.       frequently reported problems in version  1.1  resulted  from
  114.       many  functions being named after their equivilent functions
  115.       in the C language.  This turned  out  to  be  confusing  for
  116.       people who were trying to learn XLISP using traditional LISP
  117.       texts as references.  Version 1.2 renames these functions to
  118.       be  compatible  with  more  traditional  dialects  of  LISP.
  119.       Version 1.3 introduces many new  LISP  functions  and  moves
  120.       closer  to the goal of being compatible with the Common Lisp
  121.       standard.  Version 1.4 introduces user  error  handling  and
  122.       breakpoint  support  as  well as more Common Lisp compatible
  123.       functions.
  124.  
  125.       A recommended text for learning LISP programming is the book
  126.       "LISP"  by Winston and Horn and published by Addison Wesley.
  127.       The first edition of this book is based on MacLisp  and  the
  128.       second  edition is based on Common Lisp.  Future versions of
  129.       XLISP will continue to migrate  towards  compatibility  with
  130.       Common Lisp.
  131.  
  132.  
  133.  
  134.       XLISP: An Experimental Object Oriented Language                 Page 4
  135.       A NOTE FROM THE AUTHOR
  136.  
  137.  
  138.       2.0  A NOTE FROM THE AUTHOR
  139.  
  140.       If you have any problems with XLISP, feel free to contact me
  141.       for  help  or  advice.   Please remember that since XLISP is
  142.       available in source form in  a  high  level  language,  many
  143.       users  have  been  making versions available on a variety of
  144.       machines.  If you call to report a problem with  a  specific
  145.       version,  I may not be able to help you if that version runs
  146.       on a machine to which I don't have access.  Please have  the
  147.       version  number  of the version that you are running readily
  148.       accessible before calling me.
  149.  
  150.       If you find a bug  in  XLISP,  first  try  to  fix  the  bug
  151.       yourself  using  the  source  code  provided.   If  you  are
  152.       successful in fixing the bug, send the bug report along with
  153.       the  fix to me.  If you don't have access to a C compiler or
  154.       are unable to fix a bug, please send the bug  report  to  me
  155.       and I'll try to fix it.
  156.  
  157.       Any suggestions for improvements  will  be  welcomed.   Feel
  158.       free  to  extend  the  language  in  whatever way suits your
  159.       needs.  However, PLEASE DO  NOT  RELEASE  ENHANCED  VERSIONS
  160.       WITHOUT  CHECKING  WITH  ME  FIRST!!  I would like to be the
  161.       clearing house for new features added to XLISP.  If you want
  162.       to  add  features for your own personal use, go ahead.  But,
  163.       if you want to distribute your enhanced version, contact  me
  164.       first.  Please remember that the goal of XLISP is to provide
  165.       a language to learn and  experiment  with  LISP  and  object
  166.       oriented programming on small computers.
  167.  
  168.  
  169.  
  170.       XLISP: An Experimental Object Oriented Language                 Page 5
  171.       XLISP COMMAND LOOP
  172.  
  173.  
  174.       3.0  XLISP COMMAND LOOP
  175.  
  176.       When XLISP is started, it first  tries  to  load  "init.lsp"
  177.       from  the  default directory.  It then loads any files named
  178.       as parameters on the command line (after appending ".lsp" to
  179.       their names).  It then issues the following prompt:
  180.  
  181.       >
  182.  
  183.       This indicates that XLISP is waiting for an expression to be
  184.       typed.   When  an  incomplete expression has been typed (one
  185.       where the left and right parens don't match)  XLISP  changes
  186.       its prompt to:
  187.  
  188.       n>
  189.  
  190.       where n is an integer indicating how  many  levels  of  left
  191.       parens remain unclosed.
  192.  
  193.       When a complete expression has been entered, XLISP  attempts
  194.       to  evaluate  that  expression.  If the expression evaluates
  195.       successfully, XLISP prints the result of the evaluation  and
  196.       then  returns  to  the  initial  prompt  waiting for another
  197.       expression to be typed.
  198.  
  199.       Input can be aborted at any time by typing the CONTROL-G key
  200.       (it may be necessary to follow CONTROL-G by RETURN).
  201.  
  202.  
  203.  
  204.       XLISP: An Experimental Object Oriented Language                 Page 6
  205.       BREAK COMMAND LOOP
  206.  
  207.  
  208.       4.0  BREAK COMMAND LOOP
  209.  
  210.       When  XLISP  encounters  an  error   while   evaluating   an
  211.       expression, it attempts to handle the error in the following
  212.       way:
  213.  
  214.       If  the  symbol  '*breakenable*'  is   true,   the   message
  215.       corresponding  to  the  error  is  printed.  If the error is
  216.       correctable, the correction  message  is  printed.   If  the
  217.       symbol '*tracenable*' is true, a trace back is printed.  The
  218.       number of entries printed depends on the value of the symbol
  219.       '*tracelimit*'.   If  this  symbol is set to something other
  220.       than a number, the  entire  trace  back  stack  is  printed.
  221.       XLISP  then  enters a read/eval/print loop to allow the user
  222.       to examine the state of the interpreter in  the  context  of
  223.       the  error.   This  loop  differs  from the normal top-leval
  224.       read/eval/print loop in that if the user  types  the  symbol
  225.       'continue' XLISP will continue from a correctable error.  If
  226.       the user types the symbol 'quit' XLISP will abort the  break
  227.       loop  and return to the top level or the next lower numbered
  228.       break loop.  When in a break loop, XLISP prefixes the  break
  229.       level to the normal prompt.
  230.  
  231.       If the symbol '*breakenable*' is  nil,  XLISP  looks  for  a
  232.       surrounding   errset  function.   If  one  is  found,  XLISP
  233.       examines the value of the print flag.  If this flag is true,
  234.       the error message is printed.  In any case, XLISP causes the
  235.       errset function call to return nil.
  236.  
  237.       If there is no surrounding errset function, XLISP prints the
  238.       error message and returns to the top level.
  239.  
  240.  
  241.  
  242.       XLISP: An Experimental Object Oriented Language                 Page 7
  243.       DATA TYPES
  244.  
  245.  
  246.       5.0  DATA TYPES
  247.  
  248.       There are several different data types  available  to  XLISP
  249.       programmers.
  250.  
  251.  
  252.             o  lists
  253.  
  254.             o  symbols
  255.  
  256.             o  strings
  257.  
  258.             o  integers
  259.  
  260.             o  objects
  261.  
  262.             o  file pointers
  263.  
  264.             o  subrs/fsubrs (built-in functions)
  265.  
  266.       Another data type is the stream.  A stream is  a  list  node
  267.       whose car points to the head of a list of integers and whose
  268.       cdr points to the last list node  of  the  list.   An  empty
  269.       stream  is  a  list node whose car and cdr are nil.  Each of
  270.       the integers in the  list  represents  a  character  in  the
  271.       stream.   When  a character is read from a stream, the first
  272.       integer from the head of the list is removed  and  returned.
  273.       When  a  character  is  written  to  a  stream,  the integer
  274.       representing the character code of the character is appended
  275.       to  the  end of the list.  When a function indicates that it
  276.       takes an input source as a  parameter,  this  parameter  can
  277.       either  be  an  input  file pointer or a stream.  Similarly,
  278.       when a function indicates that it takes an output sink as  a
  279.       parameter,  this  parameter  can  either  be  an output file
  280.       pointer or a stream.
  281.  
  282.  
  283.  
  284.       XLISP: An Experimental Object Oriented Language                 Page 8
  285.       THE EVALUATOR
  286.  
  287.  
  288.       6.0  THE EVALUATOR
  289.  
  290.       The process of evaluation in XLISP:
  291.  
  292.             o  Integers,  strings,  objects,  file  pointers,  and
  293.                subrs evaluate to themselves
  294.  
  295.             o  Symbols evaluate to the value associated with their
  296.                current binding
  297.  
  298.             o  Lists are evaluated by evaluating the first element
  299.                of the list
  300.  
  301.                 o  If it evaluates to a subr, the  remaining  list
  302.                    elements  are  evaluated and the subr is called
  303.                    with these evaluated expressions as arguments.
  304.  
  305.                 o  If it evaluates  to  an  fsubr,  the  fsubr  is
  306.                    called  using  the  remaining  list elements as
  307.                    arguments  (they  are  evaluated  by  the  subr
  308.                    itself if necessary)
  309.  
  310.                 o  If it evaluates to a list and the  car  of  the
  311.                    list  is  'lambda', the remaining list elements
  312.                    are evaluated and the resulting expressions are
  313.                    bound  to  the  formal  arguments of the lambda
  314.                    expression.   The  body  of  the  function   is
  315.                    executed within this new binding environment.
  316.  
  317.                 o  If it evaluates to a list and the  car  of  the
  318.                    list  is  'macro',  the remaining list elements
  319.                    are bound to the formal arguments of the  macro
  320.                    expression.    The  body  of  the  function  is
  321.                    executed within this new  binding  environment.
  322.                    The result of this evaluation is considered the
  323.                    macro expansion.  This result is then evaluated
  324.                    in place of the original expression.
  325.  
  326.                 o  If it evaluates to an object, the  second  list
  327.                    element  is  evaluated  and  used  as a message
  328.                    selector.  The message formed by combining  the
  329.                    selector  with the values of the remaining list
  330.                    elements is sent to the object.
  331.  
  332.  
  333.  
  334.  
  335.  
  336.       XLISP: An Experimental Object Oriented Language                 Page 9
  337.       LEXICAL CONVENTIONS
  338.  
  339.  
  340.       7.0  LEXICAL CONVENTIONS
  341.  
  342.       The following conventions are followed when  entering  XLISP
  343.       programs:
  344.  
  345.       Comments in XLISP code begin with a semi-colon character and
  346.       continue to the end of the line.
  347.  
  348.       Symbol names  in  XLISP  can  consist  of  any  sequence  of
  349.       non-blank printable characters except the following:
  350.  
  351.               ( ) ' ` , " ;
  352.  
  353.       Upper and lower case characters are distinct.   The  symbols
  354.       'CAR' and 'car' are not the same.  The names of all built-in
  355.       functions are in lower case.   The  names  of  all  built-in
  356.       objects  are  lower  case  with  an initial capital.  Symbol
  357.       names must not begin with a digit.
  358.  
  359.       Integer literals consist of a sequence of digits  optionally
  360.       beginning with a '+' or '-'.  The range of values an integer
  361.       can represent is limited by the size of a  C  'int'  on  the
  362.       machine that XLISP is running on.
  363.  
  364.       Literal strings are sequences of  characters  surrounded  by
  365.       double  quotes.   Within quoted strings the '\' character is
  366.       used to allow non-printable characters to be included.   The
  367.       codes recognized are:
  368.  
  369.               \\      means the character '\'
  370.               \n      means newline
  371.               \t      means tab
  372.               \r      means return
  373.               \e      means escape
  374.               \nnn    means the character whose octal code is nnn
  375.  
  376.       XLISP defines several useful read macros:
  377.  
  378.               '<expr>  == (quote <expr>)
  379.               #'<expr> == (function <expr>)
  380.               `<expr>  == (backquote <expr>)
  381.               ,<expr>  == (comma <expr>)
  382.               ,@<expr> == (comma-at <expr>)
  383.  
  384.  
  385.  
  386.       XLISP: An Experimental Object Oriented Language                Page 10
  387.       OBJECTS
  388.  
  389.  
  390.       8.0  OBJECTS
  391.  
  392.       Definitions:
  393.  
  394.             o  selector - a symbol used to select  an  appropriate
  395.                method
  396.  
  397.             o  message - a selector and a list of actual arguments
  398.  
  399.             o  method - the code that implements a message
  400.  
  401.       Since XLISP was  created  to  provide  a  simple  basis  for
  402.       experimenting  with  object oriented programming, one of the
  403.       primitive data types included was 'object'.   In  XLISP,  an
  404.       object  consists of a data structure containing a pointer to
  405.       the object's class as well as a list containing  the  values
  406.       of the object's instance variables.
  407.  
  408.       Officially, there is no way to see inside an object (look at
  409.       the  values  of  its  instance  variables).  The only way to
  410.       communicate with an object is by sending it a message.  When
  411.       the  XLISP  evaluator  evaluates  a  list the value of whose
  412.       first element is an object, it interprets the value  of  the
  413.       second  element  of the list (which must be a symbol) as the
  414.       message selector.  The evaluator determines the class of the
  415.       receiving object and attempts to find a method corresponding
  416.       to the message selector in the set of messages  defined  for
  417.       that  class.   If  the  message is not found in the object's
  418.       class and the class has a super-class, the search  continues
  419.       by  looking  at  the  messages  defined for the super-class.
  420.       This process continues from  one  super-class  to  the  next
  421.       until  a  method  for the message is found.  If no method is
  422.       found, an error occurs.
  423.  
  424.       When a method is found, the evaluator  binds  the  receiving
  425.       object  to  the  symbol 'self', binds the class in which the
  426.       method was found to the symbol 'msgclass', and evaluates the
  427.       method  using the remaining elements of the original list as
  428.       arguments  to  the  method.   These  arguments  are   always
  429.       evaluated prior to being bound to their corresponding formal
  430.       arguments.  The result of evaluating the method becomes  the
  431.       result of the expression.
  432.  
  433.  
  434.  
  435.       XLISP: An Experimental Object Oriented Language                Page 11
  436.       OBJECTS
  437.  
  438.  
  439.       Classes:
  440.  
  441.       Object  THE TOP OF THE CLASS HEIRARCHY
  442.  
  443.           Messages:
  444.  
  445.               show    SHOW AN OBJECT'S INSTANCE VARIABLES
  446.                   returns     the object
  447.  
  448.               class   RETURN THE CLASS OF AN OBJECT
  449.                   returns     the class of the object
  450.  
  451.               isnew   THE DEFAULT OBJECT INITIALIZATION ROUTINE
  452.                   returns     the object
  453.  
  454.               sendsuper <sel> [<args>...] SEND SUPERCLASS A MESSAGE
  455.                   <sel>       the message selector
  456.                   <args>      the message arguments
  457.                   returns     the result of sending the message
  458.  
  459.  
  460.  
  461.       XLISP: An Experimental Object Oriented Language                Page 12
  462.       OBJECTS
  463.  
  464.  
  465.       Class   THE CLASS OF ALL OBJECT CLASSES (including itself)
  466.  
  467.           Messages:
  468.  
  469.               new     CREATE A NEW INSTANCE OF A CLASS
  470.                   returns     the new class object
  471.  
  472.               isnew [<scls>]  INITIALIZE A NEW CLASS
  473.                   <scls>      the superclass
  474.                   returns     the new class object
  475.  
  476.               answer <msg> <fargs> <code>     ADD A MESSAGE TO A CLASS
  477.                   <msg>       the message symbol
  478.                   <fargs>     the formal argument list
  479.                                 this list is of the form:
  480.                                   (<farg>...
  481.                                    [&optional <oarg>...]
  482.                                    [&rest <rarg>]
  483.                                    [&aux <aux>...])
  484.                                 where
  485.                                   <farg>   a formal argument
  486.                                   <oarg>   an optional argument (default is nil)
  487.                                   <rarg>   bound to the rest of the arguments
  488.                                   <aux>    a auxiliary variable (set to nil)
  489.                   <code>      a list of executable expressions
  490.                   returns     the object
  491.  
  492.               ivars <vars>    DEFINE THE LIST OF INSTANCE VARIABLES
  493.                   <vars>      the list of instance variable symbols
  494.                   returns     the object
  495.  
  496.               cvars <vars>    DEFINE THE LIST OF CLASS VARIABLES
  497.                   <vars>      the list of class variable symbols
  498.                   returns     the object
  499.  
  500.  
  501.       When a new instance of a class is  created  by  sending  the
  502.       message  'new'  to  an  existing  class, the message 'isnew'
  503.       followed by whatever parameters were  passed  to  the  'new'
  504.       message is sent to the newly created object.
  505.  
  506.       When a new class is created by sending the 'new' message  to
  507.       the  object  'Class', an optional parameter may be specified
  508.       indicating  the  superclass  of  the  new  class.   If  this
  509.       parameter  is  omitted,  the new class will be a subclass of
  510.       'Object'.  A class inherits all  instance  variables,  class
  511.       variables, and methods from its super-class.
  512.  
  513.  
  514.  
  515.       XLISP: An Experimental Object Oriented Language                Page 13
  516.       SYMBOLS
  517.  
  518.  
  519.       9.0  SYMBOLS
  520.  
  521.  
  522.             o  self  -  the  current  object  (within  a   message
  523.                context)
  524.  
  525.             o  msgclass - the class in which  the  current  method
  526.                was found
  527.  
  528.             o  *oblist* - the object list
  529.  
  530.             o  *keylist* - the keyword list
  531.  
  532.             o  *standard-input* - the standard input file
  533.  
  534.             o  *standard-output* - the standard output file
  535.  
  536.             o  *breakenable* - flag controlling entering the break
  537.                loop on errors
  538.  
  539.             o  *tracenable* - flag controlling trace back printout
  540.                on errors and breaks
  541.  
  542.             o  *tracelimit* - maximum number of  levels  of  trace
  543.                back information printed on errors and breaks
  544.  
  545.             o  *evalhook* -  user  substitute  for  the  evaluator
  546.                function
  547.  
  548.             o  *applyhook* - (not yet implemented)
  549.  
  550.             o  *unbound* - indicator for unbound symbols
  551.  
  552.  
  553.  
  554.  
  555.       XLISP: An Experimental Object Oriented Language                Page 14
  556.       EVALUATION FUNCTIONS
  557.  
  558.  
  559.       10.0  EVALUATION FUNCTIONS
  560.  
  561.       (eval <expr>)  EVALUATE AN XLISP EXPRESSION
  562.           <expr>      the expression to be evaluated
  563.           returns     the result of evaluating the expression
  564.  
  565.       (apply <fun> <args>)  APPLY A FUNCTION TO A LIST OF ARGUMENTS
  566.           <fun>       the function to apply (or function symbol)
  567.           <args>      the argument list
  568.           returns     the result of applying the function to the argument list
  569.  
  570.       (funcall <fun> <arg>...)  CALL A FUNCTION WITH ARGUMENTS
  571.           <fun>       the function to call (or function symbol)
  572.           <arg>       arguments to pass to the function
  573.           returns     the result of calling the function with the arguments
  574.  
  575.       (quote <expr>)  RETURN AN EXPRESSION UNEVALUATED
  576.           <expr>      the expression to be quoted (quoted)
  577.           returns     <expr> unevaluated
  578.  
  579.       (function <expr>)  QUOTE A FUNCTION (THIS IS THE SAME AS QUOTE)
  580.           <expr>      the function to be quoted (quoted)
  581.           returns     <expr> unevaluated
  582.  
  583.       (backquote <expr>)  FILL IN A TEMPLATE
  584.           <expr>      the template
  585.           returns     a copy of the template with comma and comma-at expressions
  586.                       expanded (see the Common Lisp reference manual)
  587.  
  588.  
  589.  
  590.       XLISP: An Experimental Object Oriented Language                Page 15
  591.       SYMBOL FUNCTIONS
  592.  
  593.  
  594.       11.0  SYMBOL FUNCTIONS
  595.  
  596.       (set <sym> <expr>)  SET THE VALUE OF A SYMBOL
  597.           <sym>       the symbol being set
  598.           <expr>      the new value
  599.           returns     the new value
  600.  
  601.       (setq [<sym> <expr>]...)  SET THE VALUE OF A SYMBOL
  602.           <sym>       the symbol being set (quoted)
  603.           <expr>      the new value
  604.           returns     the new value
  605.  
  606.       (setf [<place> <expr>]...)  SET THE VALUE OF A FIELD
  607.           <place>     the field specifier (quoted):
  608.                           <sym>                set the value of a symbol
  609.                           (car <expr>)         set the car of a list node
  610.                           (cdr <expr>)         set the cdr of a list node
  611.                           (get <sym> <prop>)   set the value of a property
  612.                           (symbol-value <sym>) set the value of a symbol
  613.                           (symbol-plist <sym>) set the property list of a symbol
  614.           <value>     the new value
  615.           returns     the new value
  616.  
  617.       (defun <sym> <fargs> <expr>...)  DEFINE A FUNCTION
  618.       (defmacro <sym> <fargs> <expr>...)  DEFINE A MACRO
  619.           <sym>       symbol being defined (quoted)
  620.           <fargs>     list of formal arguments (quoted)
  621.                         this list is of the form:
  622.                           (<farg>...
  623.                            [&optional <oarg>...]
  624.                            [&rest <rarg>]
  625.                            [&aux <aux>...])
  626.                         where
  627.                           <farg>      is a formal argument
  628.                           <oarg>      is an optional argument (default is nil)
  629.                           <rarg>      bound to the rest of the arguments
  630.                           <aux>       is an auxiliary variable (set to nil)
  631.           <expr>      expressions constituting the body of the
  632.                       function (quoted)
  633.           returns     the function symbol
  634.  
  635.       (gensym [<tag>])  GENERATE A SYMBOL
  636.           <tag>       string or number
  637.           returns     the new symbol
  638.  
  639.       (intern <pname>)  MAKE AN INTERNED SYMBOL
  640.           <pname>     the symbol's print name string
  641.           returns     the new symbol
  642.  
  643.       (make-symbol <pname>)  MAKE AN UNINTERNED SYMBOL
  644.           <pname>     the symbol's print name string
  645.           returns     the new symbol
  646.  
  647.  
  648.  
  649.       XLISP: An Experimental Object Oriented Language                Page 16
  650.       SYMBOL FUNCTIONS
  651.  
  652.  
  653.       (symbol-name <sym>)  GET THE PRINT NAME OF A SYMBOL
  654.           <sym>       the symbol
  655.           returns     the symbol's print name
  656.  
  657.       (symbol-value <sym>)  GET THE VALUE OF A SYMBOL
  658.           <sym>       the symbol
  659.           returns     the symbol's value
  660.  
  661.       (symbol-plist <sym>)  GET THE PROPERTY LIST OF A SYMBOL
  662.           <sym>       the symbol
  663.           returns     the symbol's property list
  664.  
  665.  
  666.  
  667.       XLISP: An Experimental Object Oriented Language                Page 17
  668.       PROPERTY LIST FUNCTIONS
  669.  
  670.  
  671.       12.0  PROPERTY LIST FUNCTIONS
  672.  
  673.       (get <sym> <prop>)  GET THE VALUE OF A PROPERTY
  674.           <sym>       the symbol
  675.           <prop>      the property symbol
  676.           returns     the property value or nil
  677.  
  678.       (remprop <prop> <sym>)  REMOVE A PROPERTY
  679.           <sym>       the symbol
  680.           <prop>      the property symbol
  681.           returns     nil
  682.  
  683.  
  684.  
  685.       XLISP: An Experimental Object Oriented Language                Page 18
  686.       LIST FUNCTIONS
  687.  
  688.  
  689.       13.0  LIST FUNCTIONS
  690.  
  691.       (car <expr>)  RETURN THE CAR OF A LIST NODE
  692.           <expr>      the list node
  693.           returns     the car of the list node
  694.  
  695.       (cdr <expr>)  RETURN THE CDR OF A LIST NODE
  696.           <expr>      the list node
  697.           returns     the cdr of the list node
  698.  
  699.       (caar <expr>) == (car (car <expr>))
  700.       (cadr <expr>) == (car (cdr <expr>))
  701.       (cdar <expr>) == (cdr (car <expr>))
  702.       (cddr <expr>) == (cdr (cdr <expr>))
  703.  
  704.       (cons <expr1> <expr2>)  CONSTRUCT A NEW LIST NODE
  705.           <expr1>     the car of the new list node
  706.           <expr2>     the cdr of the new list node
  707.           returns     the new list node
  708.  
  709.       (list <expr>...)  CREATE A LIST OF VALUES
  710.           <expr>      expressions to be combined into a list
  711.           returns     the new list
  712.  
  713.       (append <expr>...)  APPEND LISTS
  714.           <expr>      lists whose elements are to be appended
  715.           returns     the new list
  716.  
  717.       (reverse <expr>)  REVERSE A LIST
  718.           <expr>      the list to reverse
  719.           returns     a new list in the reverse order
  720.  
  721.       (last <list>)  RETURN THE LAST LIST NODE OF A LIST
  722.           <list>      the list
  723.           returns     the last list node in the list
  724.  
  725.       (member <expr> <list> [<key> <test>])  FIND AN EXPRESSION IN A LIST
  726.           <expr>      the expression to find
  727.           <list>      the list to search
  728.           <key>       the keyword :test or :test-not
  729.           <test>      the test function (defaults to eql)
  730.           returns     the remainder of the list starting with the expression
  731.  
  732.       (assoc <expr> <alist> [<key> <test>])  FIND AN EXPRESSION IN AN A-LIST
  733.           <expr>      the expression to find
  734.           <alist>     the association list
  735.           <key>       the keyword :test or :test-not
  736.           <test>      the test function (defaults to eql)
  737.           returns     the alist entry or nil
  738.  
  739.  
  740.  
  741.       XLISP: An Experimental Object Oriented Language                Page 19
  742.       LIST FUNCTIONS
  743.  
  744.  
  745.       (remove <expr> <list> [<key> <test>])  REMOVE AN EXPRESSION FROM A LIST
  746.           <expr>      the expression to delete
  747.           <list>      the list
  748.           <key>       the keyword :test or :test-not
  749.           <test>      the test function (defaults to eql)
  750.           returns     the list with the matching expressions deleted
  751.  
  752.       (length <expr>)  FIND THE LENGTH OF A LIST
  753.           <expr>      the list
  754.           returns     the length of the list
  755.  
  756.       (nth <n> <list>)  RETURN THE NTH ELEMENT OF A LIST
  757.           <n>         the number of the element to return (zero origin)
  758.           <list>      the list
  759.           returns     the nth element or nil if the list isn't that long
  760.  
  761.       (nthcdr <n> <list>)  RETURN THE NTH CDR OF A LIST
  762.           <n>         the number of the element to return (zero origin)
  763.           <list>      the list
  764.           returns     the nth cdr or nil if the list isn't that long
  765.  
  766.       (mapc <fcn> <list1>...<listn>)  APPLY FUNCTION TO SUCCESSIVE CARS
  767.           <fcn>       the function or function name
  768.           <list1..n>  a list for each argument of the function
  769.           returns     the first list of arguments
  770.  
  771.       (mapcar <fcn> <list1>...<listn>)  APPLY FUNCTION TO SUCCESSIVE CARS
  772.           <fcn>       the function or function name
  773.           <list1..n>  a list for each argument of the function
  774.           returns     the list of values returned by each function invocation
  775.  
  776.       (mapl <fcn> <list1>...<listn>)  APPLY FUNCTION TO SUCCESSIVE CDRS
  777.           <fcn>       the function or function name
  778.           <list1..n>  a list for each argument of the function
  779.           returns     the first list of arguments
  780.  
  781.       (maplist <fcn> <list1>...<listn>)  APPLY FUNCTION TO SUCCESSIVE CDRS
  782.           <fcn>       the function or function name
  783.           <list1..n>  a list for each argument of the function
  784.           returns     the list of values returned by each function invocation
  785.  
  786.  
  787.  
  788.       XLISP: An Experimental Object Oriented Language                Page 20
  789.       LIST FUNCTIONS
  790.  
  791.  
  792.       (subst <to> <from> <expr> [<key> <test>])  SUBSTITUTE EXPRESSIONS
  793.           <to>        the new expression
  794.           <from>      the old expression
  795.           <expr>      the expression in which to do the substitutions
  796.           <key>       the keyword :test or :test-not
  797.           <test>      the test function (defaults to eql)
  798.           returns     the expression with substitutions
  799.  
  800.       (sublis <alist> <expr> [<key> <test>])  SUBSTITUTE USING AN A-LIST
  801.           <alist>     the association list
  802.           <expr>      the expression in which to do the substitutions
  803.           <key>       the keyword :test or :test-not
  804.           <test>      the test function (defaults to eql)
  805.           returns     the expression with substitutions
  806.  
  807.  
  808.  
  809.       XLISP: An Experimental Object Oriented Language                Page 21
  810.       DESTRUCTIVE LIST FUNCTIONS
  811.  
  812.  
  813.       14.0  DESTRUCTIVE LIST FUNCTIONS
  814.  
  815.       (rplaca <list> <expr>)  REPLACE THE CAR OF A LIST NODE
  816.           <list>      the list node
  817.           <expr>      the new value for the car of the list node
  818.           returns     the list node after updating the car
  819.  
  820.       (rplacd <list> <expr>)  REPLACE THE CDR OF A LIST NODE
  821.           <list>      the list node
  822.           <expr>      the new value for the cdr of the list node
  823.           returns     the list node after updating the cdr
  824.  
  825.       (nconc <list>...)  DESTRUCTIVELY CONCATENATE LISTS
  826.           <list>      lists to concatenate
  827.           returns     the result of concatenating the lists
  828.  
  829.       (delete <expr> <list> [<key> <test>])  DELETE AN EXPRESSION FROM A LIST
  830.           <expr>      the expression to delete
  831.           <list>      the list
  832.           <key>       the keyword :test or :test-not
  833.           <test>      the test function (defaults to eql)
  834.           returns     the list with the matching expressions deleted
  835.  
  836.  
  837.  
  838.       XLISP: An Experimental Object Oriented Language                Page 22
  839.       PREDICATE FUNCTIONS
  840.  
  841.  
  842.       15.0  PREDICATE FUNCTIONS
  843.  
  844.       (atom <expr>)  IS THIS AN ATOM?
  845.           <expr>      the expression to check
  846.           returns     t if the value is an atom, nil otherwise
  847.  
  848.       (symbolp <expr>)  IS THIS A SYMBOL?
  849.           <expr>      the expression to check
  850.           returns     t if the expression is a symbol, nil otherwise
  851.  
  852.       (numberp <expr>)  IS THIS A NUMBER?
  853.           <expr>      the expression to check
  854.           returns     t if the expression is a symbol, nil otherwise
  855.  
  856.       (null <expr>)  IS THIS AN EMPTY LIST?
  857.           <expr>      the list to check
  858.           returns     t if the list is empty, nil otherwise
  859.  
  860.       (not <expr>)  IS THIS FALSE?
  861.           <expr>      the expression to check
  862.           return      t if the expression is nil, nil otherwise
  863.  
  864.       (listp <expr>)  IS THIS A LIST?
  865.           <expr>      the expression to check
  866.           returns     t if the value is a list node or nil, nil otherwise
  867.  
  868.       (consp <expr>)  IS THIS A NON-EMPTY LIST?
  869.           <expr>      the expression to check
  870.           returns     t if the value is a list node, nil otherwise
  871.  
  872.       (boundp <sym>)  IS THIS A BOUND SYMBOL?
  873.           <sym>       the symbol
  874.           returns     t if a value is bound to the symbol, nil otherwise
  875.  
  876.  
  877.  
  878.       XLISP: An Experimental Object Oriented Language                Page 23
  879.       PREDICATE FUNCTIONS
  880.  
  881.  
  882.       (minusp <expr>)  IS THIS NUMBER NEGATIVE?
  883.           <expr>      the number to test
  884.           returns     t if the number is negative, nil otherwise
  885.  
  886.       (zerop <expr>)  IS THIS NUMBER ZERO?
  887.           <expr>      the number to test
  888.           returns     t if the number is zero, nil otherwise
  889.  
  890.       (plusp <expr>)  IS THIS NUMBER POSITIVE?
  891.           <expr>      the number to test
  892.           returns     t if the number is positive, nil otherwise
  893.  
  894.       (evenp <expr>)  IS THIS NUMBER EVEN?
  895.           <expr>      the number to test
  896.           returns     t if the number is even, nil otherwise
  897.  
  898.       (oddp <expr>)  IS THIS NUMBER ODD?
  899.           <expr>      the number to test
  900.           returns     t if the number is odd, nil otherwise
  901.  
  902.       (eq <expr1> <expr2>)  ARE THE EXPRESSIONS IDENTICAL?
  903.           <expr1>     the first expression
  904.           <expr2>     the second expression
  905.           returns     t if they are equal, nil otherwise
  906.  
  907.       (eql <expr1> <expr2>)  ARE THE EXPRESSIONS IDENTICAL?
  908.                               (WORKS WITH NUMBERS AND STRINGS)
  909.           <expr1>     the first expression
  910.           <expr2>     the second expression
  911.           returns     t if they are equal, nil otherwise
  912.  
  913.       (equal <expr1> <expr2>)  ARE THE EXPRESSIONS EQUAL?
  914.           <expr1>     the first expression
  915.           <expr2>     the second expression
  916.           returns     t if they are equal, nil otherwise
  917.  
  918.  
  919.  
  920.       XLISP: An Experimental Object Oriented Language                Page 24
  921.       CONTROL FUNCTIONS
  922.  
  923.  
  924.       16.0  CONTROL FUNCTIONS
  925.  
  926.       (cond <pair>...)  EVALUATE CONDITIONALLY
  927.           <pair>      pair consisting of:
  928.                           (<pred> <expr>...)
  929.                         where
  930.                           <pred>      is a predicate expression
  931.                           <expr>      evaluated if the predicate
  932.                                       is not nil
  933.           returns     the value of the first expression whose predicate
  934.                       is not nil
  935.  
  936.       (and <expr>...)  THE LOGICAL AND OF A LIST OF EXPRESSIONS
  937.           <expr>...   the expressions to be ANDed
  938.           returns     nil if any expression evaluates to nil,
  939.                       otherwise the value of the last expression
  940.                       (evaluation of expressions stops after the first
  941.                        expression that evaluates to nil)
  942.  
  943.       (or <expr>...)  THE LOGICAL OR OF A LIST OF EXPRESSIONS
  944.           <expr>...   the expressions to be ORed
  945.           returns     nil if all expressions evaluate to nil,
  946.                       otherwise the value of the first non-nil expression
  947.                       (evaluation of expressions stops after the first
  948.                        expression that does not evaluate to nil)
  949.  
  950.       (if <texpr> <expr1> [<expr2>])  EXECUTE EXPRESSIONS CONDITIONALLY
  951.           <texpr>     the test expression
  952.           <expr1>     the expression to be evaluated if texpr is non-nil
  953.           <expr2>     the expression to be evaluated if texpr is nil
  954.           returns     the value of the selected expression
  955.  
  956.       (let (<binding>...) <expr>...)  BIND SYMBOLS AND EVALUATE EXPRESSIONS
  957.       (let* (<binding>...) <expr>...)  LET WITH SEQUENTIAL BINDING
  958.           <binding>   the variable bindings each of which is either:
  959.                       1)  a symbol (which is initialized to nil)
  960.                       2)  a list whose car is a symbol and whose cadr
  961.                               is an initialization expression
  962.           <expr>...   the expressions to be evaluated
  963.           returns     the value of the last expression
  964.  
  965.       (catch <sym> [<expr>]...)  EVALUATE EXPRESSIONS AND CATCH THROWS
  966.           <sym>       the catch tag
  967.           <expr>...   expressions to evaluate
  968.           returns     the value of the last expression the throw expression
  969.  
  970.       (throw <sym> [<expr>])  THROW TO A CATCH
  971.           <sym>       the catch tag
  972.           <expr>      the value for the catch to return (defaults to nil)
  973.           returns     never returns
  974.  
  975.  
  976.  
  977.       XLISP: An Experimental Object Oriented Language                Page 25
  978.       LOOPING FUNCTIONS
  979.  
  980.  
  981.       17.0  LOOPING FUNCTIONS
  982.  
  983.       (do ([<binding>]...) (<texpr> [<rexpr>]...) [<expr>]...)
  984.       (do* ([<binding>]...) (<texpr> [<rexpr>]...) [<expr>]...)
  985.           <binding>   the variable bindings each of which is either:
  986.                       1)  a symbol (which is initialized to nil)
  987.                       2)  a list of the form: (<sym> <init> [<step>])
  988.                           where:
  989.                               <sym>  is the symbol to bind
  990.                               <init> is the initial value of the symbol
  991.                               <step> is a step expression
  992.           <texpr>     the termination test expression
  993.           <rexpr>...  result expressions (the default is nil)
  994.           <expr>...   the body of the loop (treated like an implicit prog)
  995.           returns     the value of the last result expression
  996.  
  997.       (dolist (<sym> <expr> [<rexpr>]) [<expr>]...)  LOOP THROUGH A LIST
  998.           <sym>       the symbol to bind to each list element
  999.           <expr>      the list expression
  1000.           <rexpr>     the result expression (the default is nil)
  1001.           <expr>...   the body of the loop (treated like an implicit prog)
  1002.  
  1003.       (dotimes (<sym> <expr> [<rexpr>]) [<expr>]...)  LOOP FROM ZERO TO N-1
  1004.           <sym>       the symbol to bind to each value from 0 to n-1
  1005.           <expr>      the number of times to loop
  1006.           <rexpr>     the result expression (the default is nil)
  1007.           <expr>...   the body of the loop (treated like an implicit prog)
  1008.  
  1009.  
  1010.  
  1011.       XLISP: An Experimental Object Oriented Language                Page 26
  1012.       THE PROGRAM FEATURE
  1013.  
  1014.  
  1015.       18.0  THE PROGRAM FEATURE
  1016.  
  1017.       (prog (<binding>...) [<expr>]...)  THE PROGRAM FEATURE
  1018.       (prog* (<binding>...) [<expr>]...)  PROG WITH SEQUENTIAL BINDING
  1019.           <binding>   the variable bindings each of which is either:
  1020.                       1)  a symbol (which is initialized to nil)
  1021.                       2)  a list whose car is a symbol and whose cadr
  1022.                               is an initialization expression
  1023.           <expr>      expressions to evaluate or tags (symbols)
  1024.           returns     nil or the argument passed to the return function
  1025.  
  1026.       (go <sym>)  GO TO A TAG WITHIN A PROG CONSTRUCT
  1027.           <sym>       the tag (quoted)
  1028.           returns     never returns
  1029.  
  1030.       (return [<expr>])  CAUSE A PROG CONSTRUCT TO RETURN A VALUE
  1031.           <expr>      the value (defaults to nil)
  1032.           returns     never returns
  1033.  
  1034.       (prog1 <expr1> [<expr>]...)  EXECUTE EXPRESSIONS SEQUENTIALLY
  1035.           <expr1>     the first expression to evaluate
  1036.           <expr>...   the remaining expressions to evaluate
  1037.           returns     the value of the first expression
  1038.  
  1039.       (prog2 <expr1> <expr2> [<expr>]...)  EXECUTE EXPRESSIONS SEQUENTIALLY
  1040.           <expr1>     the first expression to evaluate
  1041.           <expr2>     the second expression to evaluate
  1042.           <expr>...   the remaining expressions to evaluate
  1043.           returns     the value of the second expression
  1044.  
  1045.       (progn [<expr>]...)  EXECUTE EXPRESSIONS SEQUENTIALLY
  1046.           <expr>...   the expressions to evaluate
  1047.           returns     the value of the last expression (or nil)
  1048.  
  1049.  
  1050.  
  1051.       XLISP: An Experimental Object Oriented Language                Page 27
  1052.       DEBUGGING AND ERROR HANDLING
  1053.  
  1054.  
  1055.       19.0  DEBUGGING AND ERROR HANDLING
  1056.  
  1057.       (error <emsg> [<arg>])  SIGNAL A NON-CORRECTABLE ERROR
  1058.           <emsg>      the error message string
  1059.           <arg>       the argument expression (printed after the message)
  1060.           returns     never returns
  1061.  
  1062.       (cerror <cmsg> <emsg> [<arg>])  SIGNAL A CORRECTABLE ERROR
  1063.           <cmsg>      the continue message string
  1064.           <emsg>      the error message string
  1065.           <arg>       the argument expression (printed after the message)
  1066.           returns     nil when continued from the break loop
  1067.  
  1068.       (break [<bmsg> [<arg>]])  ENTER A BREAK LOOP
  1069.           <bmsg>      the break message string (defaults to "**BREAK**")
  1070.           <arg>       the argument expression (printed after the message)
  1071.           returns     nil when continued from the break loop
  1072.  
  1073.       (errset <expr> [<pflag>])  TRAP ERRORS
  1074.           <expr>      the expression to execute
  1075.           <pflag>     flag to control printing of the error message
  1076.           returns     the value of the last expression consed with nil
  1077.                       or nil on error
  1078.  
  1079.       (baktrace [<n>])  PRINT N LEVELS OF TRACE BACK INFORMATION
  1080.           <n>         the number of levels (defaults to all levels)
  1081.           returns     nil
  1082.  
  1083.       (evalhook <expr> <ehook> <ahook>)  EVALUATE AN EXPRESSION WITH HOOKS
  1084.           <expr>      the expression to evaluate
  1085.           <ehook>     the value for *evalhook*
  1086.           <ahook>     the value for *applyhook*
  1087.           returns     the result of evaluating the expression
  1088.  
  1089.  
  1090.  
  1091.       XLISP: An Experimental Object Oriented Language                Page 28
  1092.       ARITHMETIC FUNCTIONS
  1093.  
  1094.  
  1095.       20.0  ARITHMETIC FUNCTIONS
  1096.  
  1097.       (+ <expr>...)  ADD A LIST OF NUMBERS
  1098.           <expr>...   the numbers
  1099.           returns     the result of the addition
  1100.  
  1101.       (- <expr>...)  SUBTRACT A LIST OF NUMBERS OR NEGATE A SINGLE NUMBER
  1102.           <expr>...   the numbers
  1103.           returns     the result of the subtraction
  1104.  
  1105.       (* <expr>...)  MULTIPLY A LIST OF NUMBERS
  1106.           <expr>...   the numbers
  1107.           returns     the result of the multiplication
  1108.  
  1109.       (/ <expr>...)  DIVIDE A LIST OF NUMBERS
  1110.           <expr>...   the numbers
  1111.           returns     the result of the division
  1112.  
  1113.       (1+ <expr>)  ADD ONE TO A NUMBER
  1114.           <expr>      the number
  1115.           returns     the number plus one
  1116.  
  1117.       (1- <expr>)  SUBTRACT ONE FROM A NUMBER
  1118.           <expr>      the number
  1119.           returns     the number minus one
  1120.  
  1121.       (rem <expr>...)  REMAINDER OF A LIST OF NUMBERS
  1122.           <expr>...   the numbers
  1123.           returns     the result of the remainder operation
  1124.  
  1125.       (min <expr>...)  THE SMALLEST OF A LIST OF NUMBERS
  1126.           <expr>...   the expressions to be checked
  1127.           returns     the smallest number in the list
  1128.  
  1129.       (max <expr>...)  THE LARGEST OF A LIST OF NUMBERS
  1130.           <expr>...   the expressions to be checked
  1131.           returns     the largest number in the list
  1132.  
  1133.       (abs <expr>)  THE ABSOLUTE VALUE OF A NUMBER
  1134.           <expr>      the number
  1135.           returns     the absolute value of the number
  1136.  
  1137.  
  1138.  
  1139.       XLISP: An Experimental Object Oriented Language                Page 29
  1140.       BITWISE LOGICAL FUNCTIONS
  1141.  
  1142.  
  1143.       21.0  BITWISE LOGICAL FUNCTIONS
  1144.  
  1145.       (bit-and <expr>...)  THE BITWISE AND OF A LIST OF NUMBERS
  1146.           <expr>      the numbers
  1147.           returns     the result of the and operation
  1148.  
  1149.       (bit-ior <expr...)  THE BITWISE INCLUSIVE OR OF A LIST OF NUMBERS
  1150.           <expr>      the numbers
  1151.           returns     the result of the inclusive or operation
  1152.  
  1153.       (bit-xor <expr...)  THE BITWISE EXCLUSIVE OR OF A LIST OF NUMBERS
  1154.           <expr>      the numbers
  1155.           returns     the result of the exclusive or operation
  1156.  
  1157.       (bit-not <expr>)  THE BITWISE NOT OF A NUMBER
  1158.           <expr>      the number
  1159.           returns     the bitwise inversion of number
  1160.  
  1161.  
  1162.  
  1163.       XLISP: An Experimental Object Oriented Language                Page 30
  1164.       RELATIONAL FUNCTIONS
  1165.  
  1166.  
  1167.       22.0  RELATIONAL FUNCTIONS
  1168.  
  1169.       The relational functions can be used to compare integers  or
  1170.       strings.   The  functions  '='  and '/=' can also be used to
  1171.       compare other types.  The result  of  these  comparisons  is
  1172.       computed the same way as for 'eq'.
  1173.  
  1174.       (< <e1> <e2>)  TEST FOR LESS THAN
  1175.           <e1>        the left operand of the comparison
  1176.           <e2>        the right operand of the comparison
  1177.           returns     the result of comparing <e1> with <e2>
  1178.  
  1179.       (<= <e1> <e2>)  TEST FOR LESS THAN OR EQUAL TO
  1180.           <e1>        the left operand of the comparison
  1181.           <e2>        the right operand of the comparison
  1182.           returns     the result of comparing <e1> with <e2>
  1183.  
  1184.       (= <e1> <e2>)  TEST FOR EQUAL TO
  1185.           <e1>        the left operand of the comparison
  1186.           <e2>        the right operand of the comparison
  1187.           returns     the result of comparing <e1> with <e2>
  1188.  
  1189.       (/= <e1> <e2>)  TEST FOR NOT EQUAL TO
  1190.           <e1>        the left operand of the comparison
  1191.           <e2>        the right operand of the comparison
  1192.           returns     the result of comparing <e1> with <e2>
  1193.  
  1194.       (>= <e1> <e2>)  TEST FOR GREATER THAN OR EQUAL TO
  1195.           <e1>        the left operand of the comparison
  1196.           <e2>        the right operand of the comparison
  1197.           returns     the result of comparing <e1> with <e2>
  1198.  
  1199.       (> <e1> <e2>)  TEST FOR GREATER THAN
  1200.           <e1>        the left operand of the comparison
  1201.           <e2>        the right operand of the comparison
  1202.           returns     the result of comparing <e1> with <e2>
  1203.  
  1204.  
  1205.  
  1206.       XLISP: An Experimental Object Oriented Language                Page 31
  1207.       STRING FUNCTIONS
  1208.  
  1209.  
  1210.       23.0  STRING FUNCTIONS
  1211.  
  1212.       (strcat <expr>...)  CONCATENATE STRINGS
  1213.           <expr>...   the strings to concatenate
  1214.           returns     the result of concatenating the strings
  1215.  
  1216.       (strlen <expr>)  COMPUTE THE LENGTH OF A STRING
  1217.           <expr>      the string
  1218.           returns     the length of the string
  1219.  
  1220.       (substr <expr> <sexpr> [<lexpr>]) EXTRACT A SUBSTRING
  1221.           <expr>      the string
  1222.           <sexpr>     the starting position
  1223.           <lexpr>     the length (default is rest of string)
  1224.           returns     substring starting at <sexpr> for <lexpr>
  1225.  
  1226.       (ascii <expr>)  NUMERIC VALUE OF CHARACTER
  1227.           <expr>      the string
  1228.           returns     the ascii code of the first character
  1229.  
  1230.       (chr <expr>)  CHARACTER EQUIVALENT OF ASCII VALUE
  1231.           <expr>      the numeric expression
  1232.           returns     a one character string whose first character is <expr>
  1233.  
  1234.       (atoi <expr>)  CONVERT AN ASCII STRING TO AN INTEGER
  1235.           <expr>      the string
  1236.           returns     the integer value of the string expression
  1237.  
  1238.       (itoa <expr>)  CONVERT AN INTEGER TO AN ASCII STRING
  1239.           <expr>      the integer
  1240.           returns     the string representation of the integer value
  1241.  
  1242.  
  1243.  
  1244.       XLISP: An Experimental Object Oriented Language                Page 32
  1245.       INPUT/OUTPUT FUNCTIONS
  1246.  
  1247.  
  1248.       24.0  INPUT/OUTPUT FUNCTIONS
  1249.  
  1250.       (read [<source> [<eof>]])  READ AN XLISP EXPRESSION
  1251.           <source>    the input source (default is standard input)
  1252.           <eof>       the value to return on end of file (default is nil)
  1253.           returns     the expression read
  1254.  
  1255.       (print <expr> [<sink>])  PRINT A LIST OF VALUES ON A NEW LINE
  1256.           <expr>      the expressions to be printed
  1257.           <sink>      the output sink (default is standard output)
  1258.           returns     nil
  1259.  
  1260.       (prin1 <expr> [<sink>])  PRINT A LIST OF VALUES
  1261.           <expr>      the expressions to be printed
  1262.           <sink>      the output sink (default is standard output)
  1263.           returns     nil
  1264.  
  1265.       (princ <expr> [<sink>])  PRINT A LIST OF VALUES WITHOUT QUOTING
  1266.           <expr>      the expressions to be printed
  1267.           <sink>      the output sink (default is standard output)
  1268.           returns     nil
  1269.  
  1270.       (terpri [<sink>])  TERMINATE THE CURRENT PRINT LINE
  1271.           <sink>      the output sink (default is standard output)
  1272.           returns     nil
  1273.  
  1274.       (flatsize <expr>)  LENGTH OF PRINTED REPRESENTATION USING PRIN1
  1275.           <expr>      the expression
  1276.           returns     the length
  1277.  
  1278.       (flatc <expr>)  LENGTH OF PRINTED REPRESENTATION USING PRINC
  1279.           <expr>      the expression
  1280.           returns     the length
  1281.  
  1282.       (explode <expr>)  CHARACTERS IN PRINTED REPRESENTATION USING PRIN1
  1283.           <expr>      the expression
  1284.           returns     the list of characters
  1285.  
  1286.       (explodec <expr>)  CHARACTERS IN PRINTED REPRESENTATION USING PRINC
  1287.           <expr>      the expression
  1288.           returns     the list of characters
  1289.  
  1290.       (maknam <list>)  BUILD AN UNINTERNED SYMBOL FROM A LIST OF CHARACTERS
  1291.           <list>      list of characters in symbol name
  1292.           returns     the symbol
  1293.  
  1294.       (implode <list>)  BUILD AN INTERNED SYMBOL FROM A LIST OF CHARACTERS
  1295.           <list>      list of characters in symbol name
  1296.           returns     the symbol
  1297.  
  1298.  
  1299.  
  1300.       XLISP: An Experimental Object Oriented Language                Page 33
  1301.       FILE I/O FUNCTIONS
  1302.  
  1303.  
  1304.       25.0  FILE I/O FUNCTIONS
  1305.  
  1306.       (openi <fname>)  OPEN AN INPUT FILE
  1307.           <fname>     the file name string
  1308.           returns     a file pointer
  1309.  
  1310.       (openo <fname>)  OPEN AN OUTPUT FILE
  1311.           <fname>     the file name string
  1312.           returns     a file pointer
  1313.  
  1314.       (close <fp>)  CLOSE A FILE
  1315.           <fp>        the file pointer
  1316.           returns     nil
  1317.  
  1318.       (read-char [<source>])  READ A CHARACTER FROM A FILE OR STREAM
  1319.           <source>    the input source (default is standard input)
  1320.           returns     the character (integer)
  1321.  
  1322.       (peek-char [<flag> [<source>]])  PEEK AT THE NEXT CHARACTER
  1323.           <flag>      flag for skipping white space (default is nil)
  1324.           <source>    the input source (default is standard input)
  1325.           returns     the character (integer)
  1326.  
  1327.       (write-char <ch> [<sink>])  WRITE A CHARACTER TO A FILE OR STREAM
  1328.           <ch>        the character to put (integer)
  1329.           <sink>      the output sink (default is standard output)
  1330.           returns     the character (integer)
  1331.  
  1332.       (readline [<source>])  READ A LINE FROM A FILE OR STREAM
  1333.           <source>    the input source (default is standard input)
  1334.           returns     the input string
  1335.  
  1336.  
  1337.  
  1338.       XLISP: An Experimental Object Oriented Language                Page 34
  1339.       SYSTEM FUNCTIONS
  1340.  
  1341.  
  1342.       26.0  SYSTEM FUNCTIONS
  1343.  
  1344.       (load <fname> [<vflag> [<pflag>]])  LOAD AN XLISP SOURCE FILE
  1345.           <fname>     the filename string (".lsp" is appended)
  1346.           <vflag>     the verbose flag (default is t)
  1347.           <pflag>     the print flag (default is nil)
  1348.           returns     the filename
  1349.  
  1350.       (gc)  FORCE GARBAGE COLLECTION
  1351.           returns     nil
  1352.  
  1353.       (expand <num>)  EXPAND MEMORY BY ADDING SEGMENTS
  1354.           <num>       the number of segments to add
  1355.           returns     the number of segments added
  1356.  
  1357.       (alloc <num>)  CHANGE NUMBER OF NODES TO ALLOCATE IN EACH SEGMENT
  1358.           <num>       the number of nodes to allocate
  1359.           returns     the old number of nodes to allocate
  1360.  
  1361.       (mem)  SHOW MEMORY ALLOCATION STATISTICS
  1362.           returns     nil
  1363.  
  1364.       (type <expr>)  RETURNS THE TYPE OF THE EXPRESSION
  1365.           <expr>      the expression to return the type of
  1366.           returns     nil if the value is nil otherwise one of the symbols:
  1367.                           SYM   for symbols
  1368.                           OBJ   for objects
  1369.                           LIST  for list nodes
  1370.                           SUBR  for subroutine nodes with evaluated arguments
  1371.                           FSUBR for subroutine nodes with unevaluated arguments
  1372.                           STR   for string nodes
  1373.                           INT   for integer nodes
  1374.                           FPTR  for file pointer nodes
  1375.  
  1376.       (exit)  EXIT XLISP
  1377.           returns     never returns
  1378.  
  1379. SHAR_EOF
  1380. if test 53349 -ne "`wc -c < 'xlisp.doc'`"
  1381. then
  1382.     echo shar: error transmitting "'xlisp.doc'" '(should have been 53349 characters)'
  1383. fi
  1384. fi # end of overwriting check
  1385. #    End of shell archive
  1386. exit 0
  1387.  
  1388.